<%-- 
    Document   : list_leagues.jsp
    Created on : Jan 1, 2013, 10:44:02 AM
    Author     : thaidacvinh
--%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="sl" uri="/WEB-INF/tlds/soccer_league-tag-lib" %>
<form action="" method="get">
    View:
    <select name="view" onchange="this.form.submit();">
        <option value="list">List</option>
        <option value="grid"${(param.view eq "grid") ? " selected" : ""}>Grid</option>
    </select>
</form>
<p>The set of soccer leagues are:</p>
<c:choose>
    <c:when test="${param.view eq 'grid'}">
        <sl:grid items="${applicationScope.leagueService.getLeagues()}" fields="year,title" fieldTitles="Year,Title" />            </c:when>
    <c:otherwise>
        <ul>
            <c:forEach var="league" items="${applicationScope.leagueService.getLeagues()}">
                <li>${league.title}</li>
            </c:forEach>
        </ul>
    </c:otherwise>
</c:choose>